/*
 * COPYRIGHT. ShenZhen JiMi Technology Co., Ltd. 2017.
 * ALL RIGHTS RESERVED.
 *
 * No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
 * on any form or by any means, electronic, mechanical, photocopying, recording, 
 * or otherwise, without the prior written permission of ShenZhen JiMi Network Technology Co., Ltd.
 *
 * Amendment History:
 * 
 * Date                   By              Description
 * -------------------    -----------     -------------------------------------------
 * 2017年7月17日    Li.Shangzhi         Create the class
 * http://www.jimilab.com/
*/

package com.jimi.samples.utils;

/**
 * @FileName Global.java
 * @Description: 
 *
 * @Date 2017年7月17日 下午3:03:52
 * @author Li.Shangzhi
 * @version 1.0
 */
public class Global {
	
	public static final class InstructionGlobals {

		/**
		 * 常规指令
		 */
		public static final String NORMAL_INS = "normalIns";

		/**
		 * 自定义指令
		 */
		public static final String CUSTOM_INS = "customIns";
		
	}

	public static final class DeviceToCode {
		public static final int Command_execution_success = 255; // 成功

		public static final int CommandsData_error = 240;// 数据错误

		public static final int CommandsNot_support = 243; // 不支持

		public static final int CommandsDevice_Busy = 252;// 设备忙

		public static final int CommandsDevice_interrupts = 238;// 设备中断

		public static final int CommandsTime_out = 225;// 超时！

		public static final int CommandsParameter_error = 226;// 参数错误

		public static final int CommandsCommand_was_not_executed_correctly = 227;// 指令未正确执行

		public static final int CommandsDevice_NONET = 228;//设备没在线
		
		public static final int CommandsDevice_NONETTRUE = 229;//网络错误（连接断开，等）

		public static final int CommandsUnknown_error = 404;//
	}
	
	public static String deviceStaus(int staus) {
		switch (staus) {
		case 103:
			return "Commands.Not_Exist";
		case 255:
			return "Commands.Command_execution_success";
		case 240:
			return "Commands.Data_error";// 数据错误
		case 243:
			return "Commands.Not_support"; // 不支持
		case 252:
			return "Commands.Device_Busy";// 设备忙
		case 238:
			return "Commands.Device_interrupts";// 设备中断
		case 225:
			return "Commands.Time_out";// 超时！
		case 226:
			return "Commands.Parameter_error";// 参数错误
		case 227:
			return "Commands.Command_was_not_executed_correctly";// 指令未正确执行
		case 228:
			return "Commands.Device_NONET";// 与设备连接错误/设备不在线
		default:
			return "Commands.Unknown_error";// 未知错误
		}
	}
	
	
}
